//
//  LFGoodsController.m
//  LoveFruit
//
//  Created by 马海江 on 16/9/26.
//  Copyright © 2016年 张令林. All rights reserved.
//

#import "LFGoodsController.h"
// 导入这个头文件
#import "LFFreshOrdergoodsModel.h"
@interface LFGoodsController ()

@end

@implementation LFGoodsController

// 单例创建
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    
    static LFGoodsController* stancetype;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        stancetype = [super allocWithZone:zone];
        //添加通知(+ - 收藏)
    [[NSNotificationCenter defaultCenter]addObserver:stancetype selector:@selector(clickdetleAddButton:) name:@"detilModel" object:nil];
    });
    
    return stancetype;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"商品收藏";
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem barBuutonItemWithTarget:self action:@selector(backItem) icon:@"btn_backItem" highlighticon:nil];
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem barButtonWithTitle:@"编辑" image:nil style:UIBarButtonItemStylePlain target:self action:@selector(editClick)];
    UIView *view = [[UIView alloc] init];
    view.backgroundColor = [UIColor colorWithHex:0xefefef];
    [self.view addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.view);
    }];

    
}
#pragma mark - 实现通知的方法
-(void)clickdetleAddButton:(NSNotification *)sender{
    LFFreshOrdergoodsModel *model = sender.userInfo[@"detilModel"];
    NSLog(@"%d",model.isShouCang);
    //这个模型为传过去的值
}
- (void)backItem{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)editClick{
    NSLog(@"编辑");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
